package cn.snmp.mutual.uk.stack;

import java.io.*;

public class AsnPrimitive extends AsnObject {
    private static final String version_id = "@(#)$Id: AsnPrimitive.java,v 3.10 2006/01/17 17:43:54 birgit Exp $ Copyright Westhawk Ltd";
    private byte type;

    public AsnPrimitive(final byte t) {
        this.type = t;
    }

    @Override
    public String toString() {
        String str = "AsnPrimitive ";
        if (this.type == -128) {
            str = "No such object";
        } else if (this.type == -127) {
            str = "No such instance";
        } else if (this.type == -126) {
            str = "End of MIB view";
        }
        return str;
    }

    @Override
    void write(final OutputStream out, final int pos) throws IOException {
        this.AsnBuildHeader(out, this.type, 0);
    }

    @Override
    public boolean equals(final Object obj) {
        return obj instanceof AsnPrimitive && this.type == ((AsnPrimitive) obj).type;
    }

    @Override
    public int hashCode() {
        return this.type;
    }
}
